package com.bright.cwduijie.duijie.repository;

import com.bright.cwduijie.duijie.pojo.po.AccSet;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.lang.Nullable;

import java.util.List;
import java.util.Set;

public interface AccSetRepository extends JpaRepository<AccSet, Integer>, JpaSpecificationExecutor<AccSet> {

    @Query("from AccSet where DATA_KEY=:dataKey")
    @Nullable
    AccSet getAccSetByDATAKEY(@Param("dataKey") String dataKey);

    @Query("from AccSet where TYSHXYDM in (:tyshxydm)")
    List<AccSet> getAccSetsByTYSHXYDM(@Param("tyshxydm") Set<String> tyshxydm);

    @Query("from AccSet where DATA_KEY in (:dataKeys)")
    List<AccSet> getAccSetsByDATAKEYS(@Param("dataKeys") List<String> dataKeys);

    @Query("from AccSet where DATA_KEY in (:dataKeys) and opType=:opType")
    List<AccSet> getAccSetsByDATAKEYSAndOpType(@Param("dataKeys") List<String> dataKeys, @Param("opType") Integer opType);

    List<AccSet> getAccSetBySjjhbz(Integer sjjhbz);

}